﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.DataVisualization.Charting;
using System.Configuration;
using System.Data.SqlClient;

public partial class product_saving_user_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    
    {
        ((AfterLogin)this.Master).mainCategory = "ACCOUNTS";
        SqlConnection conn = DBManager.getSqlConnection();

        string sql = "select accountNo ,balance from  SAVING_ACCOUNT where custID = '" + Session["userId"] + "'";
        SqlCommand cmd = new SqlCommand(sql, conn);
        cmd.Connection.Open();
        SqlDataReader dr = cmd.ExecuteReader();

        int curYear = DateTime.Now.Year;
        this.ddlMonth.Items.Add(new ListItem("January", curYear + "01"));
        this.ddlMonth.Items.Add(new ListItem("February", curYear + "02"));
        this.ddlMonth.Items.Add(new ListItem("March", curYear + "03"));
        this.ddlMonth.Items.Add(new ListItem("April", curYear + "04"));
        this.ddlMonth.Items.Add(new ListItem("May", curYear + "05"));
        this.ddlMonth.Items.Add(new ListItem("June", curYear + "06"));
        this.ddlMonth.Items.Add(new ListItem("July", curYear + "07"));
        this.ddlMonth.Items.Add(new ListItem("August", curYear + "08"));
        this.ddlMonth.Items.Add(new ListItem("September", curYear + "09"));
        this.ddlMonth.Items.Add(new ListItem("October", curYear + "10"));
        this.ddlMonth.Items.Add(new ListItem("November", curYear + "11"));
        this.ddlMonth.Items.Add(new ListItem("December", curYear + "12"));

        
    }
    protected void Chart1_Load(object sender, EventArgs e)
    {
        
        string strConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection myConnection = new SqlConnection(strConnectionString);


        Chart1.ChartAreas.ElementAt(0).AxisX.Title = "";

        if (ddlMonth.SelectedItem.Value == "January")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "January";
        }

        if (ddlMonth.SelectedItem.Value == "February")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "February";
        }

        if (ddlMonth.SelectedItem.Value == "March")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "March";
        }

        if (ddlMonth.SelectedItem.Value == "April")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "April";
        }

        if (ddlMonth.SelectedItem.Value == "May")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "May";
        }

        if (ddlMonth.SelectedItem.Value == "June")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "June";
        }

        if (ddlMonth.SelectedItem.Value == "July")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "July";
        }

        if (ddlMonth.SelectedItem.Value == "August")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "August";
        }

        if (ddlMonth.SelectedItem.Value == "September")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "September";
        }

        if (ddlMonth.SelectedItem.Value == "October")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "October";
        }

        if (ddlMonth.SelectedItem.Value == "November")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "November";
        }

        if (ddlMonth.SelectedItem.Value == "December")
        {
            Chart1.ChartAreas.ElementAt(0).AxisX.Title = "December";
        }

        Chart1.ChartAreas.ElementAt(0).AxisY.Title = "Total Amount ($)";
        
    }
}